package com.junlong0716.enjoylearning.adapter

import android.view.View
import android.widget.LinearLayout
import com.blankj.utilcode.util.TimeUtils
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.junlong0716.enjoylearning.R
import com.junlong0716.enjoylearning.entity.StudyNoteEntity

/**
 *@author: 巴黎没有摩天轮Li
 *@description:
 *@date: Created in 下午9:50 2018/5/6
 *@modified by:
 */
class StudyNotesAdapter(data: ArrayList<StudyNoteEntity>, resLayout: Int) : BaseQuickAdapter<StudyNoteEntity, BaseViewHolder>(resLayout, data) {
    override fun convert(helper: BaseViewHolder?, item: StudyNoteEntity?) {
        helper!!.setText(R.id.tv_my_mind, item!!.noteContent)

        if (item.knowledgeId == 0) {
            helper.getView<LinearLayout>(R.id.ll_knowledge_content).visibility = View.GONE
            //helper.setVisible(R.id.ll_knowledge_content, false)
        } else {
            helper.setText(R.id.tv_title, item.knowledgeTitle)
            helper.setText(R.id.tv_content, item.remarks)
            helper.addOnClickListener(R.id.ll_knowledge_content)
        }

        helper.addOnClickListener(R.id.tv_delete)
        helper.addOnClickListener(R.id.tv_edit)
        helper.setText(R.id.tv_time, "笔记于${TimeUtils.millis2String(item.createDate)}记录")
//        helper!!.setText(R.id.tv_title,item!!.title)
//        helper.setText(R.id.tv_content,item.content)
    }
}